﻿<UserControl
  x:Class="River.Folderize.UI.PropertiesPanel"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
  mc:Ignorable="d" Focusable="True" x:ClassModifier="internal"
  d:DesignHeight="315" d:DesignWidth="450" Background="#4CA0A0A0" IsVisibleChanged="VisibilityChanged" KeyUp="CheckEscape">

  <UserControl.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Folderize;component/Themes/Generic.xaml" />
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </UserControl.Resources>
  
  <Grid Margin="30,30,10,10">
    <Border
      BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"
      BorderThickness="2" Background="#F2FFFFFF" Padding="10">
      <Border.Effect>
        <DropShadowEffect ShadowDepth="5" Opacity="0.5" BlurRadius="7"/>
      </Border.Effect>
      <DockPanel LastChildFill="False">
        <Label x:Name="titleLabel" Content="New Library" FontFamily="Tahoma" FontSize="14"
           DockPanel.Dock="Top" Foreground="Green"/>

        <Grid DockPanel.Dock="Top" HorizontalAlignment="Stretch" Margin="30,20,10,0">
          <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
          </Grid.ColumnDefinitions>
          <Label Content="Name:" Grid.Column="0" Grid.Row="0" Margin="0,4,8,4" HorizontalAlignment="Left" VerticalAlignment="Center"/>
          <TextBox
            x:Name="nameBox" Text="{Binding Name}"
            KeyboardNavigation.TabIndex="0"
            Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch" Height="22"
            FocusManager.FocusedElement="{Binding RelativeSource={RelativeSource Self}}"/>
          <Label
            Content="Path:" Grid.Column="0" Grid.Row="1" Margin="0,4,8,4"
            HorizontalAlignment="Left" VerticalAlignment="Center" />
          <DockPanel Grid.Column="1" Grid.Row="1" LastChildFill="True">
            <Button 
              x:Name="pathButton"
              Content="..." DockPanel.Dock="Right" Width="20" Height="22" Margin="8,0,0,0"
              KeyboardNavigation.TabIndex="2"
              VerticalAlignment="Center" Click="ChoosePath"/>
            <TextBox
              x:Name="pathBox" Text="{Binding Path}"
              KeyboardNavigation.TabIndex="1"
              HorizontalAlignment="Stretch" Height="22" DockPanel.Dock="Left" VerticalAlignment="Center"
              Margin="0" LostFocus="ChangedPath" />
          </DockPanel>
          <Label Content="Icon:" Grid.Column="0" Grid.Row="2" Margin="0,4,8,4" HorizontalAlignment="Left" VerticalAlignment="Center" />
          <Button
            Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" Padding="3" Margin="10"
            Background="Transparent" BorderBrush="Transparent" Cursor="Hand" Click="ChangeIcon">
            <Button.Content>
              <Image
                x:Name="iconImage" Source="{Binding Image}"
                KeyboardNavigation.TabIndex="3"
                Width="32" Height="32" Margin="0"/>
            </Button.Content>
          </Button>
        </Grid>
        <DockPanel DockPanel.Dock="Bottom" Margin="10" LastChildFill="True" >
          <Button x:Name="cancelButton" Content="Cancel" DockPanel.Dock="Right" KeyboardNavigation.TabIndex="5" Width="70" Height="20" Margin="6,0,0,0" Click="ClickCancel"/>
          <Button x:Name="okButton" Content="OK" DockPanel.Dock="Right" KeyboardNavigation.TabIndex="4" Width="70" Height="20" IsDefault="True" Click="ClickOK"/>
          <Label
            x:Name="errorLabel" DockPanel.Dock="Left" Height="20" Padding="0" Margin="0,0,8,0"
            HorizontalAlignment="Stretch" VerticalAlignment="Center"
            Foreground="Red"/>
        </DockPanel>
      </DockPanel>
    </Border>
  </Grid>
</UserControl>
